package com.chaihu.front.components.menu;


import com.chaihu.core.context.IPageData;
import com.chaihu.front.service.menu.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;

@Component("menu")
public class MenuComponent {


    @Autowired
    private MenuService menuService;

    /**
     * 查询左侧菜单树
     *
     * @param pd
     * @return
     */
    public ResponseEntity<String> getMenus(IPageData pd) {
        return menuService.getMenusByUserId(pd);
    }

    public ResponseEntity<String> list(IPageData pd) {
        return menuService.listMenus(pd);
    }

    public ResponseEntity<String> save(IPageData pd){
        return menuService.saveMenu(pd);
    }

    public ResponseEntity<String> update(IPageData pd){
        return menuService.updateMenu(pd);
    }

    public ResponseEntity<String> delete(IPageData pd){
        return menuService.deleteMenu(pd);
    }

}
